// 集中管理异步请求，方便后期维护，提高可复用性
import request from "../utils/request";

// 登录
export const userLogin = ({ username, password }) => {
  return request.post("/login", { username, password });
};

// 账号分配（帮被人注册）
export const userReg = (userObj) => {
  return request.post("/users", userObj);
};

// 新增角色
export const rolePost = (roleObj) => {
  return request.post("/classes/VueRole", roleObj);
};

// 加载角色
export const roleGet = (id = "") => {
  let cond = id ? `/${id}` : "";
  return request.get(`/classes/VueRole${cond}`);
};

// 修改角色
export const rolePut = (id, roleObj) => {
  return request.put(`/classes/VueRole/${id}`, roleObj);
};

// 删除角色
export const roleDel = (id) => {
  return request.delete(`/classes/VueRole/${id}`);
};
